<? //include/PAYMENT_session.php

include("PAYMENT.php");

require_once'../include/database.php';
$conn = new Connection();
$conn->NewConnection('localhost','ecommerce','root','batavia');
class SessionPAYMENT { 


 
 function find($id){
    
   global $conn;
   
   $query = "select PaymentID,PaymentType,Allowed from PAYMENT where PaymentID='$id'";
   
   $run = mysql_query($query) or die(mysql_error());
   
   $row = mysql_fetch_array($run, MYSQL_ASSOC);
   
   $numRow = mysql_numrows($run);
   
   if($numRow)
   
   {
   
   $this->PAYMENT= new PAYMENT();


   
	$this->PAYMENT->setPaymentID($row['PaymentID']);

 
	$this->PAYMENT->setPaymentType($row['PaymentType']);

 
	$this->PAYMENT->setAllowed($row['Allowed']);

 
}
return $this->PAYMENT;
}

function insert($PAYMENT){
	global $conn;
	$query = "insert into PAYMENT(PaymentID,PaymentType,Allowed) values('".$PAYMENT->getPaymentID()."','".$PAYMENT->getPaymentType()."','".$PAYMENT->getAllowed()."')";
 
 $parse=mysql_query($query);

 }
 
 function findall(){
	$query = "select PaymentID,PaymentType,Allowed from PAYMENT";
	$parse=mysql_query($query);
	$datas = array();
	while($row=mysql_fetch_assoc($parse))
	{
		$data = array();$data['PaymentID'] = $row['PaymentID'];
		$data['PaymentType'] = $row['PaymentType'];
		$data['Allowed'] = $row['Allowed'];
		$datas[] = $data;
	 }
	return $datas;
	}
	function delete($PAYMENT){
	$query = "delete from PAYMENT where PaymentID= '".$PAYMENT->getPaymentID()."'";
	$parse=mysql_query($query);
	return $parse;

	}
	
	function update($PAYMENT){
	$query = "update PAYMENT set PaymentType= '".$PAYMENT->getPaymentType()."',Allowed= '".$PAYMENT->getAllowed()."' where PaymentID= '".$PAYMENT->getPaymentID()."'";
$parse=mysql_query($query);

}


}
 //include/PAYMENT_session.php